Skip to main content

Complete Nextcloud & Memories Installation Guide

Overview

This comprehensive guide covers the complete installation and configuration of Nextcloud with the Memories app for professional photo and video management. The setup includes Docker containerization, hardware acceleration for video transcoding, facial recognition, and enterprise-ready security configurations.

What is Nextcloud?

Nextcloud is a powerful, open-source cloud storage and collaboration platform that provides:

  • File Storage & Sync: Secure file storage with cross-platform synchronization
  • Photo Management: Advanced photo organization with AI-powered features
  • Video Streaming: Hardware-accelerated video transcoding and streaming
  • Collaboration Tools: Document editing, calendar, contacts, and more
  • Enterprise Security: End-to-end encryption and comprehensive access controls

What is Memories?

Memories is a powerful Nextcloud app that transforms your instance into a professional photo management system:

  • AI-Powered Organization: Automatic photo categorization and facial recognition
  • Hardware Acceleration: GPU-accelerated video transcoding for smooth playback
  • Timeline View: Beautiful chronological photo and video browsing
  • Advanced Search: Find photos by location, date, people, and objects
  • Mobile Apps: Native mobile applications for seamless access

Architecture Overview

Internet → Reverse Proxy → Nextcloud (Port 9111) → MariaDB (Port 3306)

Go-VOD (Hardware Acceleration)

Redis (Caching)

Collabora (Office Suite)

Key Benefits

  • Professional Photo Management: Enterprise-grade photo organization and AI features
  • Hardware Acceleration: GPU-powered video transcoding for optimal performance
  • Self-Hosted Privacy: Complete control over your data and privacy
  • Scalable Architecture: Docker-based deployment for easy scaling
  • Enterprise Security: Advanced security features and access controls
  • Collaboration Ready: Built-in office suite and sharing capabilities

Prerequisites

Before beginning the installation, ensure your system meets all requirements:

System Requirements

Minimum Requirements

  • Operating System: Windows 10/11, Linux, or macOS with Docker support
  • RAM: 8GB system memory (16GB+ recommended)
  • Storage: 50GB available disk space (SSD recommended)
  • Processor: 64-bit multi-core processor (4+ cores recommended)
  • GPU: Optional but recommended for hardware acceleration
  • Operating System: Linux (Ubuntu 22.04 LTS) or Windows 11 Pro
  • RAM: 32GB+ system memory for large photo libraries
  • Storage: NVMe SSD with 500GB+ available space
  • Processor: Modern multi-core processor (8+ cores)
  • GPU: NVIDIA GTX 1060 or better for hardware acceleration
  • Network: Gigabit ethernet for optimal performance

Hardware Acceleration Support

GPU TypeSupportedTranscodingNotes
NVIDIA GTX 10xx+✅ YesNVENC/NVDECRecommended
NVIDIA RTX Series✅ YesNVENC/NVDECBest Performance
Intel Quick Sync✅ YesVA-APIGood Performance
AMD GPU⚠️ LimitedVA-APIBasic Support
CPU Only✅ YesSoftwareSlower Performance

Software Prerequisites

  • Docker Desktop: Latest version with Docker Compose
  • Git: For configuration file management
  • Text Editor: VS Code or similar for configuration editing
  • Web Browser: Modern browser for Nextcloud interface
  • Domain Name: For production deployment (optional for development)

Network Requirements

  • Port 9111: Nextcloud web interface
  • Port 9980: Collabora Office (optional)
  • Port 3306: MariaDB (internal only)
  • Port 6379: Redis (internal only)
  • Port 47788: Go-VOD transcoding service (internal only)

Installation Process

Step 1: Environment Preparation

Create Project Directory

Create Nextcloud project directory

mkdir -p C:\Tools\Nextcloud
cd C:\Tools\Nextcloud

Create required subdirectories

mkdir -p db data config

Verify Docker Installation

Verify Docker is running

docker --version
docker compose --version

Test Docker functionality

docker run hello-world

Check available resources

docker system info

Step 2: Configuration Files Setup

Create Docker Compose Configuration

Create docker-compose.yml:

name: nextcloud

services:
db:
image: mariadb:10.11
container_name: nextcloud-mariadb
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- ./db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=SecureRootPassword123!
- MYSQL_PASSWORD=NextcloudPassword123!
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
networks:
- nextcloud-network

redis:
container_name: nextcloud-redis
image: redis:7-alpine
restart: always
command: redis-server --save 60 1 --loglevel warning --requirepass RedisPassword123!
volumes:
- ./redis:/data
networks:
- nextcloud-network

app:
image: nextcloud:28-apache
container_name: nextcloud-app
restart: always
ports:
- "9111:80"
depends_on:
- db
- redis
volumes:
- ./data:/var/www/html
- ./config:/var/www/html/config
- /path/to/your/photos:/data/photos
environment:
- MYSQL_PASSWORD=NextcloudPassword123!
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- REDIS_HOST=redis
- REDIS_HOST_PASSWORD=RedisPassword123!
- NEXTCLOUD_ADMIN_USER=admin
- NEXTCLOUD_ADMIN_PASSWORD=AdminPassword123!
- NEXTCLOUD_TRUSTED_DOMAINS=localhost yourdomain.com
networks:
- nextcloud-network

cron:
image: nextcloud:28-apache
container_name: nextcloud-cron
restart: always
volumes:
- ./data:/var/www/html
- ./config:/var/www/html/config
depends_on:
- db
- redis
entrypoint: /cron.sh
networks:
- nextcloud-network

# Hardware-accelerated video transcoding
go-vod:
image: radialapps/go-vod:latest
container_name: nextcloud-go-vod
restart: always
depends_on:
- app
environment:
- NEXTCLOUD_HOST=http://app
- NEXTCLOUD_ALLOW_INSECURE=1
volumes:
- ./data:/var/www/html
- /path/to/your/photos:/data/photos
# Uncomment for NVIDIA GPU support
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
# Uncomment for Intel/AMD GPU support
# devices:
# - /dev/dri:/dev/dri
networks:
- nextcloud-network

# Optional: Collabora Office
collabora:
container_name: nextcloud-collabora
image: collabora/code:latest
restart: always
ports:
- "9980:9980"
cap_add:
- MKNOD
environment:
- domain=yourdomain.com
- username=admin
- password=CollaboraPassword123!
- DONT_GEN_SSL_CERT=1
networks:
- nextcloud-network

networks:
nextcloud-network:
driver: bridge

volumes:
db:
redis:
data:
config:

Create Custom Dockerfile (Optional)

For advanced features like facial recognition, create Dockerfile:

FROM nextcloud:28-apache

# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
libmagickwand-dev \
libgmp3-dev \
libbz2-dev \
python3 \
python3-pip \
python3-setuptools \
python3-dev \
dlib-data \
libdlib-dev \
libblas-dev \
liblapack-dev \
libatlas-base-dev \
&& rm -rf /var/lib/apt/lists/*

# Install PHP extensions for enhanced functionality
RUN docker-php-ext-install \
gmp \
bz2

# Install ImageMagick PHP extension
RUN pecl install imagick && docker-php-ext-enable imagick

# Install Python dependencies for facial recognition
RUN pip3 install \
numpy \
dlib \
face_recognition \
pillow

# Copy custom configuration files
COPY nextcloud.ini /usr/local/etc/php/conf.d/nextcloud.ini
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY cron.sh /cron.sh

# Set proper permissions
RUN chmod +x /cron.sh

# Expose port
EXPOSE 80

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost/status.php || exit 1

Create PHP Configuration

Create nextcloud.ini:

; Nextcloud PHP Configuration
memory_limit = 2G
upload_max_filesize = 10G
post_max_size = 10G
max_input_time = 3600
max_execution_time = 3600
max_file_uploads = 100

; OPcache settings
opcache.enable = 1
opcache.enable_cli = 1
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 256
opcache.save_comments = 1
opcache.revalidate_freq = 2

; Redis session handling
session.save_handler = redis
session.save_path = "tcp://redis:6379?auth=RedisPassword123!"

; Security settings
expose_php = Off
display_errors = Off
log_errors = On
error_log = /var/log/php_errors.log

Create Supervisor Configuration

Create supervisord.conf:

[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:apache2]
command=/usr/sbin/apache2ctl -D FOREGROUND
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0

[program:cron]
command=/usr/sbin/cron -f
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=true

Create Cron Script

Create cron.sh:

#!/bin/bash
set -eu

exec busybox crond -f -l 0 -L /dev/stdout

Step 3: Initial Deployment

Build Custom Image (if using Dockerfile)

Build custom Nextcloud image

docker build -t nextcloud-enhanced:latest .

Update docker-compose.yml to use custom image Change: image: nextcloud:28-apache To: image: nextcloud-enhanced:latest

Deploy Nextcloud Stack

Start the Nextcloud stack

docker compose up -d

Monitor deployment progress

docker compose logs -f

Verify all containers are running

docker compose ps

Initial Setup Verification

Check container health

docker compose exec app php occ status

Verify database connection

docker compose exec db mysql -u nextcloud -p nextcloud -e "SHOW TABLES;"

Test Redis connection

docker compose exec redis redis-cli -a RedisPassword123! ping

Nextcloud Configuration

Step 4: Initial Nextcloud Setup

Access Nextcloud Web Interface

  1. Open your web browser and navigate to http://localhost:9111
  2. Wait for initial setup (may take 5-10 minutes on first launch)

image

  1. Complete the setup wizard:
    • Admin Username: Choose a secure admin username (avoid 'admin')
    • Admin Password: Use a strong password (minimum 12 characters)
    • Data Directory: /var/www/html/data (default)
    • Database: Configure MariaDB connection
      • Database User: nextcloud
      • Database Password: NextcloudPassword123!
      • Database Name: nextcloud
      • Database Host: db:3306

image

Verify Initial Installation

Check Nextcloud status

docker compose exec app php occ status

Verify database tables

docker compose exec app php occ db:convert-filecache-bigint

Run initial maintenance

docker compose exec app php occ maintenance:update:htaccess

Step 5: Install and Configure Memories App

Install Memories from App Store

  1. Navigate to Apps in Nextcloud admin interface

image

  1. Search for "Memories" in the app store

image

  1. Install the Memories app

image

  1. Enable the app after installation

image

Install Additional Required Apps

Install apps via command line (alternative method)

docker compose exec app php occ app:install memories
docker compose exec app php occ app:install recognize
docker compose exec app php occ app:install preview_generator

Enable the apps

docker compose exec app php occ app:enable memories
docker compose exec app php occ app:enable recognize
docker compose exec app php occ app:enable preview_generator

Step 6: Configure Hardware Acceleration

Enable Go-VOD for Video Transcoding

  1. Update docker-compose.yml to enable Go-VOD service:
# Uncomment the go-vod service in your docker-compose.yml
go-vod:
image: radialapps/go-vod:latest
container_name: nextcloud-go-vod
restart: always
depends_on:
- app
environment:
- NEXTCLOUD_HOST=http://app
- NEXTCLOUD_ALLOW_INSECURE=1
volumes:
- ./data:/var/www/html
- /path/to/your/photos:/data/photos
# For NVIDIA GPU support
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
# For Intel/AMD GPU support (alternative)
# devices:
# - /dev/dri:/dev/dri
networks:
- nextcloud-network
  1. Restart the stack with hardware acceleration:

Recreate containers with new configuration

docker compose up -d --force-recreate --remove-orphans

Verify Go-VOD is running

docker compose logs go-vod

Configure Memories for Hardware Acceleration

  1. Navigate to Admin SettingsMemories

image

  1. Configure Go-VOD connection:
    • Bind Address: 127.0.0.1:47788
    • Connection Address: go-vod:47788

image

  1. Configure transcoding settings:
    • Enable hardware acceleration: ✅
    • Video codec: H.264 (NVENC for NVIDIA, VA-API for Intel/AMD)
    • Quality preset: Balanced
    • Resolution: 1080p, 720p, 480p

Verify Hardware Acceleration

Check Go-VOD logs for GPU usage

docker compose logs go-vod | grep -i "cuda\|nvenc\|vaapi"

Test video transcoding Upload a video file and check transcoding in Memories app

Step 7: Configure Facial Recognition

Install Recognition Dependencies

If using custom Dockerfile with facial recognition:

Build custom image with facial recognition

docker build -t nextcloud-enhanced:latest .

Update docker-compose.yml to use custom image Change: image: nextcloud:28-apache To: image: nextcloud-enhanced:latest

Recreate with custom image

docker compose up -d --force-recreate

Configure Recognition Settings

  1. Navigate to Admin SettingsRecognize

image

  1. Enable facial recognition: ✅

image

  1. Configure recognition settings:
    • Model: Face recognition model
    • Minimum confidence: 0.7 (recommended)
    • Maximum faces per image: 10

image

Final configuration overview:

image

Initialize Facial Recognition

Run initial face recognition scan

docker compose exec app php occ recognize:classify

Monitor recognition progress

docker compose exec app php occ recognize:status

Step 8: Performance Optimization

Configure Preview Generation

Configure preview generation for better performance

docker compose exec app php occ config:app:set preview max_x --value 2048
docker compose exec app php occ config:app:set preview max_y --value 2048
docker compose exec app php occ config:app:set preview jpeg_quality --value 60

Generate previews for existing files

docker compose exec app php occ preview:generate-all

Optimize Database

Add database indices for better performance

docker compose exec app php occ db:add-missing-indices

Convert to big int for large installations

docker compose exec app php occ db:convert-filecache-bigint

Configure Caching

Configure Redis caching

docker compose exec app php occ config:system:set redis host --value="redis"
docker compose exec app php occ config:system:set redis port --value=6379 --type=integer
docker compose exec app php occ config:system:set redis password --value="RedisPassword123!"
docker compose exec app php occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu"
docker compose exec app php occ config:system:set memcache.distributed --value="\\OC\\Memcache\\Redis"
docker compose exec app php occ config:system:set memcache.locking --value="\\OC\\Memcache\\Redis"

Security Configuration

Step 9: Security Hardening

Configure Trusted Domains

Add trusted domains for external access

docker compose exec app php occ config:system:set trusted_domains 0 --value="localhost"
docker compose exec app php occ config:system:set trusted_domains 1 --value="yourdomain.com"
docker compose exec app php occ config:system:set trusted_domains 2 --value="www.yourdomain.com"

Configure Reverse Proxy Support

Configure trusted proxies

docker compose exec app php occ config:system:set trusted_proxies 0 --value="127.0.0.1"
docker compose exec app php occ config:system:set trusted_proxies 1 --value="172.18.0.0/16"

Configure forwarded headers

docker compose exec app php occ config:system:set forwarded_for_headers 0 --value="HTTP_X_FORWARDED_FOR"
docker compose exec app php occ config:system:set forwarded_for_headers 1 --value="HTTP_X_FORWARDED_HOST"

Enable Security Features

Force HTTPS (for production)

docker compose exec app php occ config:system:set overwriteprotocol --value="https"

Enable two-factor authentication

docker compose exec app php occ app:install twofactor_totp
docker compose exec app php occ app:enable twofactor_totp

Configure security headers

docker compose exec app php occ config:system:set overwrite.cli.url --value="https://yourdomain.com"

Step 10: Backup Configuration

Configure Automated Backups

Create backup script backup-nextcloud.sh:

#!/bin/bash
set -e

# Configuration
BACKUP_DIR="/backups/nextcloud"
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_NAME="nextcloud_backup_$DATE"

# Create backup directory
mkdir -p "$BACKUP_DIR"

# Stop Nextcloud (optional, for consistency)
docker compose exec app php occ maintenance:mode --on

# Backup database
docker compose exec db mysqldump -u nextcloud -pNextcloudPassword123! nextcloud > "$BACKUP_DIR/${BACKUP_NAME}_database.sql"

# Backup Nextcloud data
tar -czf "$BACKUP_DIR/${BACKUP_NAME}_data.tar.gz" -C ./data .

# Backup configuration
tar -czf "$BACKUP_DIR/${BACKUP_NAME}_config.tar.gz" -C ./config .

# Resume Nextcloud
docker compose exec app php occ maintenance:mode --off

# Cleanup old backups (keep last 7 days)
find "$BACKUP_DIR" -name "nextcloud_backup_*" -mtime +7 -delete

echo "Backup completed: $BACKUP_NAME"

Schedule Automated Backups

Make backup script executable

chmod +x backup-nextcloud.sh

Add to crontab for daily backups at 2 AM

crontab -e

Add: 0 2 * * * /path/to/backup-nextcloud.sh

Monitoring and Maintenance

Step 11: Monitoring Setup

Health Monitoring

Create health check script

cat > health-check.sh << 'EOF'
#!/bin/bash

Check container health

docker compose ps

Check Nextcloud status

docker compose exec app php occ status

Check disk usage

df -h

Check memory usage

free -h

Check Go-VOD transcoding

docker compose logs --tail=10 go-vod
EOF
chmod +x health-check.sh

Log Monitoring

Monitor Nextcloud logs

docker compose logs -f app

Monitor database logs

docker compose logs -f db

Monitor Go-VOD transcoding logs

docker compose logs -f go-vod

Check system logs

docker compose exec app tail -f /var/www/html/data/nextcloud.log

Step 12: Maintenance Tasks

Regular Maintenance Commands

Update file cache

docker compose exec app php occ files:scan --all

Clean up old versions and trash

docker compose exec app php occ versions:cleanup
docker compose exec app php occ trashbin:cleanup --all-users

Update preview cache

docker compose exec app php occ preview:pre-generate

Optimize database

docker compose exec app php occ db:add-missing-indices

Update Procedures

Update Nextcloud (backup first!)

docker compose pull
docker compose up -d

Run upgrade process

docker compose exec app php occ upgrade

Update apps

docker compose exec app php occ app:update --all

Troubleshooting

Common Issues and Solutions

Issue 1: Go-VOD Not Working

Symptoms:

  • Video transcoding fails
  • No hardware acceleration
  • Go-VOD container not starting

Solutions:

Check GPU availability

nvidia-smi  # For NVIDIA GPUs
lspci | grep VGA # For all GPUs

Verify Docker GPU support

docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

Check Go-VOD logs

docker compose logs go-vod

Restart Go-VOD service

docker compose restart go-vod

Issue 2: Facial Recognition Not Working

Symptoms:

  • No faces detected
  • Recognition app errors
  • Missing dependencies

Solutions:

Check recognition status

docker compose exec app php occ recognize:status

Reinstall recognition models

docker compose exec app php occ recognize:download-models

Run manual classification

docker compose exec app php occ recognize:classify --force

Issue 3: Performance Issues

Diagnostic Steps:

Check resource usage

docker stats

Monitor database performance

docker compose exec db mysql -u nextcloud -p -e "SHOW PROCESSLIST;"

Check Redis performance

docker compose exec redis redis-cli info stats

Analyze slow queries

docker compose exec app php occ log:file --lines=100 | grep -i slow

Optimization Solutions:

Increase PHP memory limit

docker compose exec app php -d memory_limit=4G occ files:scan --all

Optimize database

docker compose exec app php occ db:add-missing-primary-keys
docker compose exec app php occ db:convert-filecache-bigint

Clear caches

docker compose exec app php occ maintenance:repair --include-expensive

Production Deployment

Step 13: Production Considerations

Domain and SSL Configuration

  1. Configure domain in docker-compose.yml:

    environment:
    - NEXTCLOUD_TRUSTED_DOMAINS=yourdomain.com,www.yourdomain.com
  2. Set up reverse proxy (Nginx/Caddy):

    server {
    listen 443 ssl http2;
    server_name yourdomain.com;

    location / {
    proxy_pass http://localhost:9111;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }
    }

Performance Scaling

Scale for production

docker compose up -d --scale app=2

Configure load balancing Use external load balancer (Nginx, HAProxy, etc.)

Security Checklist

  • Strong passwords for all accounts
  • Two-factor authentication enabled
  • HTTPS only in production
  • Regular security updates
  • Firewall configuration
  • Regular backups tested and verified
  • Log monitoring and alerting
  • Access controls properly configured

Summary

You have successfully installed and configured a complete Nextcloud & Memories system with:

Professional Nextcloud installation with Docker containerization
Memories app with AI-powered photo management and timeline view
Hardware acceleration with GPU-powered video transcoding
Facial recognition with automated photo categorization
Enterprise security with proper authentication and access controls
Performance optimization with Redis caching and preview generation
Monitoring and maintenance procedures for production reliability
Backup strategies with automated data protection

Your Nextcloud & Memories installation is now ready for professional photo and video management with enterprise-level features and performance.

Buy me pc parts
💬Join Discord
Buy me a coffee